package com.baicaoyuan.web.repository;

import com.baicaoyuan.web.model.ProjectItemDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface ProjectItemRepository extends JpaRepository<ProjectItemDO, Long> {
    List<ProjectItemDO> findByProjectFkAndStatusNot(Long project_fk,String status);

    @Transactional
    @Modifying
    @Query(value = "update t_project_item set status = ?2 where id = ?1", nativeQuery = true)
    Integer updateStatus(Long id, String status);
}
